package face.pay.web.terminal;

import face.pay.common.enterprise.service.IterminalBaseService;
import face.pay.entity.TerminalInfo;
import face.pay.entity.UserInfo;
import face.pay.security.annotation.CurrentUser;
import face.pay.util.ResultMessage;
import face.pay.util.page.PageData;
import face.pay.util.page.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: zkj
 * @Date: 2019/8/13 15:30
 * @Description:
 */
@Controller
@RequestMapping("/agency_terminal")
public class AgencyTerminalController {

    @Autowired
    private IterminalBaseService iterminalBaseService;

    /**
     * 代理商下面所有的设备
     * @return
     */
    @RequestMapping("/list")
    public String manager(){

        return  "agency/terminal_list";
    }


    @ResponseBody
    @RequestMapping("/queryData")
    public PageData<TerminalInfo> queryPage(TerminalInfo terminalInfo, PageParam pageParam, @CurrentUser UserInfo loginUser){
        terminalInfo.setAgencyUserId(loginUser.getId());
        return  iterminalBaseService.queryPage(terminalInfo,pageParam,loginUser);
    }


    @ResponseBody
    @RequestMapping("/unLock")
    public ResultMessage unBing(TerminalInfo terminalInfo,@CurrentUser UserInfo loginUser){
        return  iterminalBaseService.unLock(terminalInfo,loginUser);
    }




}
